Linux System Administration
last edited Sat, 02 Nov 2024 08:20:08 GMT
backlinks: null
This guide does not cover Securing Linux servers
Booting direct link to this section
Stop the GRUB boot process by pressing <Escape>
during the brief time before it boots the default kernel in the default way.
- boot alternative kernel
- modify selected kernel
Daemons direct link to this section
Systemd direct link to this section
- List the states of all services configured to attempt to start:
systemctl
- List all available services and whether they are enabled or not:
systemctl list-unit-files
- list details of two services
systemctl status service1 service
Enabled services will not start until next boot, services that are started will not automatically start at reboot.
Runit direct link to this section
Services are managed in the background through their respective service directories, an executable named run executes a process in the background. Service names are based on the contents inside the /var/service/
directory.
Enabling and disabling a service
ln -s /etc/sv/<service> /var/service/
# disable
rm /var/service/<service>
Print Working Directory direct link to this section
pwd
Create a New User direct link to this section
Creating a new user with a -m
flag results in a home directory being created
sudo useradd -m username
interactive prompt, actually a front end for useradd
adduser <user>
view all available options
useradd -h
set user password
passwd user02
add user to superuser group direct link to this section
usermod -aG sudo <user>
Managing Permissions direct link to this section
Access Level | Octal Value |
---|---|
read | 4 |
write | 2 |
execute | 1 |
chmod 740 file2
# chmod u=rwx,g=r,o-rwx file2
This is commonly refered as absolute mode.
Device Managment direct link to this section
/etc/fstab
can be used to manage temporary and permanent drives. Using UUIDs is preferred because device names may change on boot. See the man pages for examples of how to format your declarations.
Manually Mounting direct link to this section
mount /dev/sda1 /mnt/exampledir
Finding UUIDs direct link to this section
blkid
# list all potential mounting points
lsblk
Building Software From Source direct link to this section
Everyone hits this wall when their chosen distro doesn't have a specific package.
Assuming you are building from tar
archives:
./configure
make
make install
For RPM based systems:
cd ~/rpmbuild/SPECS
rpmbuild -bb package.spec
tree ../RPMS
rpmbuild --clean package.spec
rpm -Uvh ../RPMS/arch/package-file.rpm
Check SSH Logs direct link to this section
cat /var/log/auth.log | grep "Failed password"
FAQ direct link to this section
Where should scripts be kept?
- personal go in
~/bin
- root only scripts in
/usr/local/sbin
- system-wide
/usr/local/bin
- temporary drives are typically kept in
/media
while permanent drives are typically located at/mnt